#include <stdio.h>
int main()
{	 	     	 	  
    int i, n, flag = 1;
    for (i = 1; i <= 10 && flag; i++)  //1
    {	 	     	 	  
        scanf("%d", &n); //1
        if (n % 7 == 0) //1
        {	 	     	 	  
            printf("%d\n", n); //1
            flag = 0; //1
        }
    }
    if (flag) //1
        printf("not exist!"); //1
    return 0;
}	 